﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;

namespace Business
{
    public class ControladorEstado
    {
        public static List<Data.status> getStatus()
        {
            dbAlertasEntities db = new dbAlertasEntities();
            var estados = from s in db.status
                          where s.Reglas.Count != 0
                          orderby s.sname
                          select s;
            return estados.ToList();
        }
        public static status getOneStatus(int idstatus)
        {
            dbAlertasEntities db = new dbAlertasEntities();
            var estado = db.status.Where(x => x.status_id == idstatus).FirstOrDefault();
            return estado;
        }
        public static status getOneStatusByDesc(string sname)
        {
            dbAlertasEntities db = new dbAlertasEntities();
            var estado = db.status.Where(x => x.sname == sname).FirstOrDefault();
            return estado;
        }
    }
}
